package ua.simplecoding.kievhome.command {
//import com.adobe.txi.todo.application.*;

//    import com.adobe.cairngorm.integration.data.IDataCache;
//    import com.adobe.txi.todo.domain.TodoModel;

import mx.collections.ArrayCollection;
import mx.rpc.AsyncToken;
import mx.rpc.remoting.RemoteObject;

import ua.simplecoding.kievhome.domain.AppartmentModel;

public class GetAppartmentSummaryListCommand {

    [Inject(id="appartmentService")]
    public var service:RemoteObject;

    [Inject]
    public var appartmentModel:AppartmentModel;

//        [Inject]
//        public var cache:IDataCache;

    public function execute(message:GetAppartmentSummaryListMessage):AsyncToken {
//        var appartmentFilterVO:AppartmentFilterVO = new AppartmentFilterVO();
        return service.getAppartmentSummaryListByFilter();
    }

    public function result(todoList:ArrayCollection, message:GetAppartmentSummaryListMessage):void {
//            todoModel.todos = cache.synchronize(todoList) as ArrayCollection;
        appartmentModel.appartmentSummaryList = todoList;
    }

    public function error(error:*, message:GetAppartmentSummaryListMessage):void {
        trace("error");
    }
}
}